package com.unionftech.common.common.model

import com.unionftech.common.common.api.CommonApiManager
import com.unionftech.common.base.mvp.impl.BaseModel
import com.unionftech.common.base.mvp.impl.IBaseCallBack
import com.unionftech.common.bean.ResponseResult

class LanguageModel : BaseModel() {
    companion object {
        private const val LANGUAGE_PROJECT_NAME = "APP"
    }

    fun getLanguage(languageCode: String, callback: IBaseCallBack<ResponseResult<String?>>) {
        execute {
            val result = request {
                val language = CommonApiManager.getInstance()
                    .apiLanguage()
                    .getLanguage(LANGUAGE_PROJECT_NAME, languageCode)
                return@request ResponseResult.buildSuccess(language)
            }
            callback.onResponse(result)
        }
    }
}